import type { PageResult, ResponseBody } from "@/api/typing";
import { request } from "@/utils/request";
import type {
  ClassParams,
  DeleteParams,
  QueryParams,
  QueryResult,
} from "./typing";

/**新增班级 */
export const add = (params: ClassParams) => {
  return request.post<ClassParams, ResponseBody>("/answer/class/add", params);
};

/**修改班级 */
export const update = (params: ClassParams) => {
  return request.put<ClassParams, ResponseBody>("/answer/class/update", params);
};

/**分页查询班级 */
export const queryByPage = (params: QueryParams) => {
  return request.get<QueryParams, ResponseBody<PageResult<QueryResult>>>(
    "/answer/class/page",
    { params }
  );
};

/**删除班级 */
export const del = (params: DeleteParams) => {
  return request.delete<DeleteParams, ResponseBody>("/answer/class/delete", {
    params,
  });
};
